package org.example.socket;

import java.io.InputStream;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.Socket;

public class UDPSocket1 {
    public static void main(String[] args) throws Exception{
        DatagramSocket socket = new DatagramSocket(3309);
        System.out.println("准备传输信息");
        InputStream input = System.in;
        byte[] b = new byte[1024];
        int read = input.read(b);
        DatagramPacket packet = new DatagramPacket(b, read, InetAddress.getByName("localhost"), 3307);
        socket.send(packet);
//        socket.
//        socket.send(new);
    }
}
